<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/6/15 0015
 * Time: 14:24
 */

namespace app\common\model;


use think\Model;
/*
 * 推广渠道管理模型类
 * */
class TgAdmin extends Model
{
    /*
     * 查询渠道信息
     * */
    public function tgData($data = [],$parameter = '*'){
        if (empty($data)){
            return $this->query('select '.$parameter.' from xb_tg_admin');
        }else{
            $str = '';
            foreach ($data as $k=>$v){
                $str.= $k.'=:'.$k.' and';
            }
            $str = rtrim($str,'and');
            $data = $this->query('select '.$parameter.' from xb_tg_admin where '.$str.'limit 1',$data);
            return !empty($data)?$data[0]:[];
        }
    }
}